package io.renren.modules.PCguanli.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.renren.modules.PCguanli.entity.ResidentPersonnelEntity;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.PCguanli.dao.ScoreDdDao;
import io.renren.modules.PCguanli.entity.ScoreDdEntity;
import io.renren.modules.PCguanli.service.ScoreDdService;


@Service("scoreDdService")
public class ScoreDdServiceImpl extends ServiceImpl<ScoreDdDao, ScoreDdEntity> implements ScoreDdService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        String key=(String) params.get("key");
        LambdaQueryWrapper<ScoreDdEntity> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.like(StringUtils.isNotEmpty(key), ScoreDdEntity::getName, key)
                .or().like(StringUtils.isNotEmpty(key), ScoreDdEntity::getExamNumber, key)
                .or().like(StringUtils.isNotEmpty(key), ScoreDdEntity::getUserId, key)
                .or().like(StringUtils.isNotEmpty(key), ScoreDdEntity::getIdcard, key);
        IPage<ScoreDdEntity> page = this.page(
                new Query<ScoreDdEntity>().getPage(params),
                queryWrapper
        );

        return new PageUtils(page);
    }

}